<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>08_继承</title>
</head>

<body>
    <script>
        //ES5
        function Phone(brand, price) {
            this.brand = brand
            this.price = price
        }

        Phone.prototype.call = function () {
            console.log('我可以打电话')
        }

        function SmartPhone(brand, price, color, size) {
            Phone.call(this, brand, price)
            this.color = color
            this.size = size
        }

        SmartPhone.prototype = new Phone
        SmartPhone.prototype.constructor = SmartPhone
        SmartPhone.prototype.playGame = function () {
            console.log('玩游戏')
        }

        const yj = new SmartPhone('yj', 2499, '黑色', '5.5inch')
        console.log(yj)

    </script>
</body>

</html>